package com.fosss.band.controller;

import com.fosss.band.service.FollowService;
import com.fosss.band.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author: fosss
 * Date: 2024/1/8
 * Time: 16:19
 * Description:
 */
@Api(tags = "关注相关接口")
@Slf4j
@RestController
@RequestMapping("/follow")
public class FollowController {

    @Resource
    private FollowService followService;

    @ApiOperation("关注、取关")
    @GetMapping("/updateStatus/{userId}/{type}/{entityId}")
    public Result followOrUnFollow(@PathVariable("userId") Integer userId,
                                   @PathVariable("type") Integer type,
                                   @PathVariable("entityId") Integer entityId) {
        log.info("关注、取关");
        return followService.followOrUnFollow(userId, type, entityId);
    }

    @ApiOperation("查询关注的乐队、专辑、歌曲")
    @GetMapping("/getFollowed/{userId}/{type}")
    public Result getFollowed(@PathVariable("userId") Integer userId,
                              @PathVariable("type") Integer type) {
        log.info("查询关注的乐队、专辑、歌曲");
        return followService.getFollowed(userId, type);
    }

}
